using System.ComponentModel;
using System.Windows;

namespace DeSleeper.Client.WakeUp
{
    ///<summary>
    /// An object containing attachable data and behavior for a <see cref="TargetComputer"/>.
    ///</summary>
    public abstract class TargetComputerAttachable : Freezable, INotifyPropertyChanged
    {
        private TargetComputer _target;

        /// <summary>
        /// The target to which properties are attached.
        /// </summary>
        public TargetComputer Target
        {
            get { return _target; }
            set { _target = value; OnPropertyChanged("Target"); }
        }

        public TargetComputerAttachable() {}
        public TargetComputerAttachable(TargetComputer target)
        {
            Target = target;
        }

        #region Implementation of INotifyPropertyChanged

        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// Invoked when a property value changes.
        /// </summary>
        /// <param name="propertyName">Name of changed property.</param>
        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion
    }
}